//
//  ResultCell.m
//  体育
//
//  Created by liujianlong on 2022/10/24.
//

#import "ResultCell.h"
@interface ResultCell()
@property (strong, nonatomic) IBOutlet UILabel *title;
@property (strong, nonatomic) IBOutlet UILabel *detail;
@property (strong, nonatomic) IBOutlet UILabel *time;
@property (strong, nonatomic) IBOutlet UILabel *home;
@property (strong, nonatomic) IBOutlet UILabel *from;
@property (strong, nonatomic) IBOutlet UILabel *homeScore;
@property (strong, nonatomic) IBOutlet UILabel *fromScore;
@property (strong, nonatomic) IBOutlet UILabel *homeScore_current;
@property (strong, nonatomic) IBOutlet UILabel *fromScore_current;
@end
@implementation ResultCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)actionForBtn:(UIButton *)sender {
    sender.selected = !sender.selected;
}
- (void)setModel:(Record *)model{
    _model = model;
    self.title.text = @"";
    self.detail.text = @"";
    self.time.text = @"";
    self.home.text = @"";
    self.from.text = @"";
    self.homeScore_current.text = @"";
    self.homeScore_current.text = @"";
    self.homeScore.text = @"";
    self.fromScore.text = @"";
    self.selectBtn.selected = _model.favorite;
    if (_model.isbasketball) {
        self.title.text = [NSString stringWithFormat:@"%@%@",[NSDate transToDate:@"MM-dd" :_model.stamp],LS(_model.league_name)];
        self.home.text = LS(_model.home);
        self.from.text = LS(_model.from);
        self.homeScore.text = !_model.finish?@"":[NSString stringWithFormat:@"%d %d %d %d",_model.fir_score_home,_model.sec_score_home,_model.thrd_score_home,_model.fth_score_home];
        self.fromScore.text = !_model.finish?@"":[NSString stringWithFormat:@"%d %d %d %d",_model.fir_score_from,_model.sec_score_from,_model.thrd_score_from,_model.fth_score_from];
        self.time.text = !_model.finish?LS(@"未"):LS(@"完");
        self.homeScore_current.text = !_model.finish?@"":[NSString stringWithFormat:@"%d",_model.score_home];
        self.fromScore_current.text = !_model.finish?@"":[NSString stringWithFormat:@"%d",_model.score_from];
    }else{
        self.title.text = [NSString stringWithFormat:@"%@%@",_model.league_name,[NSDate transToDate:@"MM-dd" :_model.stamp]];
        self.from.text = LS(_model.home);
        self.fromScore_current.text = LS(_model.from);
        self.fromScore.text = !_model.finish ? @"vs" : [NSString stringWithFormat:@"%d:%d",_model.score_home,_model.score_from];
        self.detail.text = !_model.finish?@"":@"90`";
        self.time.text = !_model.finish?@"":[NSString stringWithFormat:@"%@%d:%d",LS(@"半"),_model.top_half_score_home,_model.top_half_score_from];
        
    }
}
@end
